<script type="text/javascript">
$(document).ready(function()
				{
					$hang=$("#countsp").val();
					$(".tong").hide();
					for($i=0;$i<parseInt($hang,10);$i++)
					{
						$(".tong"+$i).hide();
					}
				$(".text").blur(function(){
											$cellvalue = $(".cellvalue").val();
											$tong =$('.tong'+$(this).get(0).id).val();
											$value=$(this).val();
											$cellvalue = parseInt($cellvalue,10);
											$tong =parseInt($tong,10);
											$value=parseInt($value,10);
											if (isNaN($cellvalue))
												$cellvalue=0;
											if (isNaN($tong))
												$tong=0;
											if (isNaN($value))
											{
												$value=0;
												$(this).val(0);
											}
											$tong = $tong + $value - $cellvalue;
											$('.tong'+$(this).get(0).id).val($tong);
										});

				$(".text").focus(function(){
					$(".cellvalue").val($(this).val());
				});
				
				$(".text").keydown(function(e) {
			        if ( e.keyCode == 46 || e.keyCode == 8  || e.keyCode == 9) {}
			        else {
			            if (e.keyCode < 48 || e.keyCode > 57 ) {
			                e.preventDefault(); 
			            }   
			        }
			    });
				}
	);

</script>
<div class="suadiemchuan_form">

<?php echo $this->Form->create('Diemchuan',array('url'=>'luudiemchuan/'.$kehoach_id));?>
<?php
	echo "</br><h3>Điểm Chuẩn:</h3>"."<b>Từ:</b> ".date('d-m-Y',strtotime(key($thoigian))) . " <b> Đến: </b>". date('d-m-Y',strtotime($thoigian[key($thoigian)]));;
	if (isset($data) && isset($data_id)) 
	{
		echo $form->input('countsp',array('id'=>'countsp','type'=>'hidden','value'=>count($hanghoas)));
    	echo $ctable->edittable('Diemchuan',$cot,$hanghoas,$data,$data_id);
	}
?>
<?php echo $this->Form->end(__('  Lưu  ', true));?>

</div>